package com.ruoyi.member.job;


import com.ruoyi.member.controller.MapWebsocket;
import com.ruoyi.member.domain.MyMap;
import com.ruoyi.member.service.ISellerMyOrderService;
import com.ruoyi.member.service.impl.SellerMyOrderServiceImpl;
import com.ruoyi.member.utils.ApplicationContextUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.TriggerKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author huang
 * @Date 2023/8/16 14:39
 * @PackageName: com.ruoyi.member.job
 * @ClassName: MyMapJob
 * @Description:
 * @Version 1.0
 */

@Component
public class MyMapJob implements Job {


    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SellerMyOrderServiceImpl sellerMyOrderService = (SellerMyOrderServiceImpl) ApplicationContextUtil.getBean("myService");
        MyMap map = sellerMyOrderService.getMap();
        Double jing = map.getJing();
        Double wei = map.getWei();
        String s = jing + "," + wei;
        System.out.println(s);
        if (MapWebsocket.isServerClose()) {
            //结束这个定时任务
            MyMapEnable.stop();
        } else {
            MapWebsocket.getMap(s);
        }
        sellerMyOrderService = null;
        System.gc();
    }
}
